use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Serialize, Deserialize)]
#[sea_orm(table_name = "transport_plans")]
pub struct Model {
    #[sea_orm(primary_key, auto_increment = false)]
    pub id: String,
    pub name: String,
    pub description: Option<String>,
    #[sea_orm(column_type = "Text")]
    pub order_ids: String, // JSON array of order IDs
    pub vehicle_id: Option<String>,
    pub driver_id: Option<String>,
    #[sea_orm(column_type = "Text")]
    pub route_data: Option<String>, // JSON route data
    pub planned_start_time: Option<DateTime>,
    pub planned_end_time: Option<DateTime>,
    pub status: i32, // 0: pending, 1: approved, 2: in_progress, 3: completed, 4: cancelled
    pub created_at: DateTime,
    pub updated_at: DateTime,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {}